/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.thienloc.omap.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author GiangLT
 */
@Entity
@Table(name = "THONG_TIN_TRAN_DAU", catalog = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ThongTinTranDau.findAll", query = "SELECT t FROM ThongTinTranDau t"),
    @NamedQuery(name = "ThongTinTranDau.findById", query = "SELECT t FROM ThongTinTranDau t WHERE t.id = :id"),
    @NamedQuery(name = "ThongTinTranDau.findByTenThongTin", query = "SELECT t FROM ThongTinTranDau t WHERE t.tenThongTin = :tenThongTin"),
    @NamedQuery(name = "ThongTinTranDau.findByNoiDung", query = "SELECT t FROM ThongTinTranDau t WHERE t.noiDung = :noiDung"),
    @NamedQuery(name = "ThongTinTranDau.findByMoTa", query = "SELECT t FROM ThongTinTranDau t WHERE t.moTa = :moTa")})
public class ThongTinTranDau implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Size(max = 100)
    @Column(name = "TEN_THONG_TIN")
    private String tenThongTin;
    @Size(max = 2000)
    @Column(name = "NOI_DUNG")
    private String noiDung;
    @Size(max = 2000)
    @Column(name = "MO_TA")
    private String moTa;
    @JoinColumn(name = "ID_TRAN_DAU", referencedColumnName = "ID")
    @ManyToOne
    private TranDau idTranDau;
    @OneToMany(mappedBy = "idThongTinCha")
    private List<ThongTinTranDau> thongTinTranDauList;
    @JoinColumn(name = "ID_THONG_TIN_CHA", referencedColumnName = "ID")
    @ManyToOne
    private ThongTinTranDau idThongTinCha;

    public ThongTinTranDau() {
    }

    public ThongTinTranDau(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTenThongTin() {
        return tenThongTin;
    }

    public void setTenThongTin(String tenThongTin) {
        this.tenThongTin = tenThongTin;
    }

    public String getNoiDung() {
        return noiDung;
    }

    public void setNoiDung(String noiDung) {
        this.noiDung = noiDung;
    }

    public String getMoTa() {
        return moTa;
    }

    public void setMoTa(String moTa) {
        this.moTa = moTa;
    }

    public TranDau getIdTranDau() {
        return idTranDau;
    }

    public void setIdTranDau(TranDau idTranDau) {
        this.idTranDau = idTranDau;
    }

    @XmlTransient
    public List<ThongTinTranDau> getThongTinTranDauList() {
        return thongTinTranDauList;
    }

    public void setThongTinTranDauList(List<ThongTinTranDau> thongTinTranDauList) {
        this.thongTinTranDauList = thongTinTranDauList;
    }

    public ThongTinTranDau getIdThongTinCha() {
        return idThongTinCha;
    }

    public void setIdThongTinCha(ThongTinTranDau idThongTinCha) {
        this.idThongTinCha = idThongTinCha;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ThongTinTranDau)) {
            return false;
        }
        ThongTinTranDau other = (ThongTinTranDau) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.thienloc.omap.entity.ThongTinTranDau[ id=" + id + " ]";
    }
    
}
